offset-info option

Contents|Index|Previous|Next
`offset-info` option

-offset-info output-file

This option simplifies access to C struct’s from assembler. For each member of each structure the compiler will output a .equ directive to associate with a symbol with the member’s offset in bytes into the structure. The symbol itself is the concatenation of the structure’s tag name and the member’s name, separated by an underscore.

This option will output, to the specified output-file, an assembler directive, .equ, for each member of each structure found in each manipulation. The .equ directives for the structures in the header file can be obtained by using the following input: gcc -fsyntax-only -offset-info m.s -x c m.h.

m.h is the header containing the structures, and m.s holds the directives.

The following is a short example of output produced by -offset-info.

      input file (for example m.h):

          struct W {
              double d;
              int I;
              };

          struct X {
              int a;
              int b;

              struct Y {
                  int a;
                  int b;
                  };

              struct Y y;
              struct Y yy[10];
              struct Y* p;
              }

          output file (for example m.s):
          .equ W_d,0
          .equ W_i,8
          .equ Y_a,0
          .equ Y_b,4
          .equ X_a,0
          .equ X_b,4
          .equ X_y,8
          .equ X_yy,16
          .equ X_p,96

-offset-info has the following caveats.

- No directives are output for bit-field members.
- No directives are output for members whose offsets (as measured in bits) is greater than the word size of the host.
- No directives are output for members whose offsets are not constants. This can happen only in structures that use some GCC specific extensions allowing for variable sized members.

-fargument-alias
-fargument-noalias
-fargument-noalias-global

Specify the possible relationships among parameters and between parameters and global data.
-fargument-alias specifies that arguments (parameters) may alias each other and may alias global storage. -fargument-noalias specifies that arguments do not alias each other, but may alias global storage. -fargument-noalias-global specifies that arguments do not alias each other and do not alias global storage.
Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself.

Top|Contents|Index|Previous|Next